<?php

/*
 * core/auth_service.php
 *
 * Provide user authentification
 */

require_once( 'auth.php' );

Service::register( 'AuthService', 'Authentification Service', 'helpless' );

class AuthService extends Service
{
	public function __construct()
	{
		parent::__construct();
		$this->registerMethod( 'authenticate', array( T_STR, T_STR ), 'Authenticate a user', 'helpless', true );
		$this->registerMethod( 'isAuthenticate', array(), 'Am I currently authenticated', 'helpless', true );
		$this->registerMethod( 'logout', array(), 'Logout current user', 'helpless', true );
	}

	// handle with core/datatypes/CBoolean
	public function authenticate( $username, $password )
	{
		return Auth::authenticate( $username, $password );
	}

	// handle with core/datatypes/CBoolean
	public function isAuthenticate()
	{
		return Auth::isAuthenticate();
	}

	// handle with core/datatypes/CBoolean
	public function logout()
	{
		return Auth::logout();
	}
}

?>
